Array.prototype.flatArr = function() {
  var arr = [];
  //定义hanle函数方便递归
  function hanle(s) {
    for (var i = 0, j = s.length; i < j; i++) {
      //历遍数组
      if (Object.prototype.toString.call(s[i].children) == "[object Array]") {
        arr.push(s[i]); //添加进新数组
        //判断是否为数组
        hanle(s[i].children); //递归调用
      } else {
        arr.push(s[i]); //添加进新数组
      }
    }
  }
  hanle(this); //this指向Array
  return arr;
};
